﻿using System;
using System.Collections.Generic;
using System.Web.UI.WebControls;

using UI.WebControls.ControlsBase;
namespace UI.WebControls
{
    /// <summary>
    /// UI层，页面控件基类，数字选择下拉列表
    /// </summary>
    public class NumberSelect : DropDownListBase
    {
        /// <summary>
        /// 显示提示
        /// </summary>
        public bool ShowTips { get; set; }

        /// <summary>
        /// 开始数字
        /// </summary>
        public int StartNumber { get; set; }
        /// <summary>
        /// 结束数字
        /// </summary>
        public int EndNumber { get; set; }

        protected override void OnLoad(EventArgs e)
        {
            if (!Page.IsPostBack) 
            {
                if (ShowTips)
                    base.Items.Add(new ListItem("=请选择=", ""));
                for (int i = StartNumber; i <= EndNumber; i++)
                    base.Items.Add(new ListItem(i.ToString(), i.ToString()));
            }
            base.OnLoad(e);
        }
    }
}
